// key value 存储值
export function setLocalStorage(key: string, value: string) {
  if (typeof window === "undefined") {
    return null; // or return a default value
  }
  sessionStorage.setItem(key, value);
}

// 通过key取值
export function getLocalStorage(key: string) {
  if (typeof window === "undefined") {
    return null; // or return a default value
  }
  return sessionStorage.getItem(key);
}

// 通过key删除值
export function removeLocalStorage(key: string) {
  if (typeof window === "undefined") {
    return null; // or return a default value
  }
  return sessionStorage.removeItem(key);
}

// 清空所有值
export function clearAllLocalStorage() {
  if (typeof window === "undefined") {
    return null; // or return a default value
  }
  sessionStorage.clear();
}


// 获取用户信息
export function getLocalUserInfo(){
  if (typeof window === "undefined") {
    return null; // or return a default value
  }
  return sessionStorage.getItem('userInfo');
}
